2.sikuli\2.sikuli

(Download this script)
Device_0000003458763848 = AndroidDevice.getDevice("0000003458763848")
Device_0000003458763848.sleep(  2217,  127)
Device_0000003458763848.verify("com.android.launcher2", "com.android.launcher2.Launcher")
Device_0000003458763848.pointer(     0, ACTION_DOWN, 419, 647)
Device_0000003458763848.pointer(    82,   ACTION_UP, 419, 647)
Device_0000003458763848.sleep(  3949,  106)
Device_0000003458763848.verify("com.android.vending", "com.android.vending.AssetBrowserActivity")
Device_0000003458763848.pointer(     0, ACTION_DOWN, 260, 279)
Device_0000003458763848.pointer(    82,   ACTION_UP, 260, 279)
Device_0000003458763848.sleep(  6196,  118)
Device_0000003458763848.verify("com.android.vending", "android.view.View")
Device_0000003458763848.pointer(     0, ACTION_DOWN, 389, 169)
Device_0000003458763848.pointer(    82,   ACTION_UP, 389, 169)
Device_0000003458763848.sleep(  4947,   72)
Device_0000003458763848.verify("com.android.vending", "com.google.android.finsky.activities.PurchaseDialog")
Device_0000003458763848.pointer(     0, ACTION_DOWN, 232, 302)
Device_0000003458763848.pointer(    68,   ACTION_UP, 232, 302)
Device_0000003458763848.sleep(135272,  648)
Device_0000003458763848.verify("com.android.vending", "com.android.vending.AssetBrowserActivity")
Device_0000003458763848.keyDown( 62)
Device_0000003458763848.sleep(   159,    6)
Device_0000003458763848.keyUp( 62)
if exists():
    print "install finished"